package com.diqye.templet.regullation;

import com.diqye.templet.core.Regullation;
/**
 * 字符串替换
 *
 * @author 秦振龙
 * @date 2013-7-8
 *
 * <b>修改记录及说明：</b>
 * <ul>
 * <li>2013-7-8  秦振龙  创建</li>
 * </ul>
 */
public class BorderRegullation implements Regullation {
	private String prefix;
	private String suffix;
	public BorderRegullation(String prefix, String suffix){
		this.prefix = prefix;
		this.suffix = suffix;
	}
	public boolean invok(String context, int[] start, int[] end) {
		int s = context.indexOf(prefix, start[0]);
		if(s != -1){
			int e = context.indexOf(suffix,s+1);
			if(e != -1){
				start[0] = s;
				end[0] = e+suffix.length();
				return true;
			}
		}
		return false;
	}

}
